package individual.ircon.bilibili.bean;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;

/**
 * uid可以为0.
 */
public class EnteryRoom implements Serializable {

    /**
     * uid : 166322281
     * roomid : 22015508
     * protover : 3
     * platform : web
     * type : 2
     * key : ---Qv8tb0Rlj
     */

    @JSONField(name = "uid")
    public Long uid;
    @JSONField(name = "roomid")
    public Long roomid;
    @JSONField(name = "protover")
    public Integer protover;
    @JSONField(name = "platform")
    public String platform;
    @JSONField(name = "type")
    public Integer type;
    @JSONField(name = "key")
    public String key;

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public Long getRoomid() {
        return roomid;
    }

    public void setRoomid(Long roomid) {
        this.roomid = roomid;
    }

    public Integer getProtover() {
        return protover;
    }

    public void setProtover(Integer protover) {
        this.protover = protover;
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    /**
     * 实例化一个EnteryRoom，默认参数为uid=0，plaform=web，type=2，protover=3。
     * @param room_id 房间ID
     * @param token DanmuInfo接口返回的token。
     * @return 一个实例
     */
    public static EnteryRoom getEnteryRoom(long room_id, String token) {
        EnteryRoom er = new EnteryRoom();
        er.uid = 0L; // 这个地方最好为0
        er.roomid = room_id;
        er.platform = "web";
        er.type = 2;
        er.protover = 3;
        er.key = token;
        return er;
    }
}
